package cc.telecomdigital.tdstock;

import cc.telecomdigital.tdstock.R;
import android.app.Dialog;
import android.content.Context;
import android.view.Gravity;
import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
import android.view.View.OnClickListener;
import android.widget.TextView;

public class LabelDialog extends Dialog implements OnClickListener
{
	protected TextView	content;

	private void init()
	{
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		/*setCanceledOnTouchOutside(true);*/
		getWindow().setGravity(Gravity.BOTTOM);
		setContentView(R.layout.labeldialog);
		content = (TextView) findViewById(R.id.topic);
		content.setOnClickListener(this);
	}

	public LabelDialog(Context context)
	{
		super(context, R.style.labelDialog);
		init();
	}

	public LabelDialog(Context context, String theContent)
	{
		super(context, R.style.labelDialog);
		init();
		content.setText(theContent);
	}

	public void setMsgContent(String msg)
	{
		content.setText(msg);
		content.postInvalidate();
	}

	public boolean onTouchEvent(MotionEvent event)
	{
		return false;
	}

	@Override
	public void onClick(View v)
	{
		/** When label is clicked, dismiss the dialog */
		if (v == content)
		{
			dismiss();

		}

	}

}
